import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

/**
 * @author Jiange
 * @create 2021-05-13-21:26
 */
public class CompletableFutureDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        var a = CompletableFuture.runAsync(()->{
        });
        var b = CompletableFuture.supplyAsync(()->{
            int l = 10 /0;
           return "jiange";
        });
        System.out.println(b.whenComplete((c, d) -> {
            System.out.println("c:-----" + c);
            System.out.println("d:----------" + d);
        }).exceptionally(f -> {
            return "这不是真正输出的，出错了会调用，返回值就是c" + f;
        }).get());
    }
}
